module.exports = {
    development(config, {paths}) {
        // change config here
        config.resolve.alias['react-dom'] = '@hot-loader/react-dom';
        // 主题色配置
        const {rules} = config.module;
        rules.map(item => {
            if (item.oneOf) {
                for (let i = 0; i < item.oneOf.length; i++) {
                    const rule = item.oneOf[i];
                    if (!(rule.test instanceof Array) && rule.test && rule.test.test('.less')) {
                        rule.use[rule.use.length - 1].options.modifyVars = {
                            '@primary-color': '#528ff2',
                            '@link-color': '#528ff2',
                        };
                    }
                }
            }
            return item;
        });
        // 去掉mew-loader
        config.module.rules = rules.filter(item => !(item.use && item.use[0] && item.use[0].loader && item.use[0].loader.includes('mew')));
    },

    production(config, {paths}) {
        config.resolve.alias['react-dom'] = '@hot-loader/react-dom';
        // 主题色配置
        const {rules} = config.module;
        rules.map(item => {
            if (item.oneOf) {
                for (let i = 0; i < item.oneOf.length; i++) {
                    const rule = item.oneOf[i];
                    if (!(rule.test instanceof Array) && rule.test && rule.test.test('.less')) {
                        rule.use[rule.use.length - 1].options.modifyVars = {
                            '@primary-color': '#528ff2',
                            '@link-color': '#528ff2',
                        };
                    }
                }
            }
            return item;
        });
        config.module.rules = rules;
    },

    server(config, {paths, proxy, allowedHost}) {
        // change config here
    }
};
